class Solution(object):
    def reformatDate(self, date):
        month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
        d, m, y = date.split(' ')
        d = d[:-2]
        if len(d) == 1:
            d = '0' + d
        m = str(month.index(m) + 1)
        if len(m) == 1:
            m = '0' + m
        return y + '-' + m + '-' + d
